import { z } from "zod";

export const loginSchema = z.object({
  email: z.string().trim().min(3, "邮箱格式错误").email("错误的邮箱格式"),
  password: z.string().min(6, "密码过短").max(20, "密码过长"),
});

export type LoginSchema = z.output<typeof loginSchema>;

export const registerSchema = z.object({
  email: z.string().trim().min(3, "邮箱格式错误").email("错误的邮箱格式"),
  password: z.string().min(6, "密码过短").max(20, "密码过长"),
  confirmPassword: z.string(),
}).refine(
  data => data.password === data.confirmPassword,
  "Passwords do not match",
);

export type RegisterSchema = z.output<typeof registerSchema>;
